// http://oj.haizeix.com/problem/275
#include <iostream>
#include <cstring>
#include <stack>

const int maxn = 1e6 + 100;
const int inf = 0x3f3f3f3f;

int p = 9939, base = 131;
char str[maxn];
long long chash[maxn], sum[maxn];

int main() {
    int m;
    scanf("%s", str + 1);
    scanf("%d", &m);
    int len = strlen(str + 1);

    for (int i = 1; i <= len; i++) {
        chash[i] = (base * chash[i - 1] + (str[i] - 'a' + 1)) % p;
        sum[i] = (sum[i - 1] * base) % p;
        // printf("%lld\n", chash[i]);
    }

    while (m--) {
        int l1, r1, l2, r2;
        scanf("%d%d%d%d", &l1, &r1, &l2, &r2);
        if ((chash[r1] - chash[l1] * sum[r1 -l1 + 1]) == (chash[r2] - chash[l2] * sum[r2 - l2 + 1])) {
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }

    return 0;
}